<template>
	<view class="body">
		<view class="bigbox">
			<view class="oneBox">
				<view class="vixitor">
					<view class="box"></view>
					<text>访客信息</text>
				</view>
				<text class="force">{{visitordeta}}</text>
			</view>
			<view class="news">
				<text>房屋</text>
				<text>{{detailsdata.visitorHouse.room}}</text>
			</view>
			<view class="news">
				<text>访客姓名</text>
				<text>{{detailsdata.visitorName}}</text>
			</view>
			<view class="news">
				<text>性别</text>
				<text>{{detailsdata.sex.sexType}}</text>
			</view>
			<view class="news">
				<text>电话号码</text>
				<text>{{detailsdata.phone}}</text>
			</view>
			<view class="news">
				<text>访问日期</text>
				<text>{{detailsdata.date}}</text>
			</view>
			<view class="news">
				<text>访问时长</text>
				<text>{{detailsdata.duration}}</text>
			</view>
		</view>
		<view @click="pass(name)">
			<view class="btn">查看通行证</view>
		</view>
	</view>
</template>

<script>
	import {http} from '../../utils/http.js'
	export default {
		data() {
			return {
				detailsdata:[],
				name:'',
				visitordeta:'',
			};
		},
		methods:{
			pass(v) {
				// console.log(v);
				uni.navigateTo({
					url: '../passCheck/passCheck?name=' + v
				});
			},
			getData(){
				http({
					url:'/visitor/list',
					method:'GET',
					params:{
						page:1,
						limit:10,
						visitorName:this.name
					}
				}).then((res)=>{
					console.log(res);
					this.detailsdata=res.data[0];
					this.visitordeta=res.data[0].visitState.visitState;
				})
			}
		},
		onLoad(option){
			this.name=option.name
			this.getData();
		}
	}
</script>

<style lang="less">
.body{
	.bigbox{
		// width: 684rpx;
		height: 794rpx;
		border: 1rpx solid #eee;
		border-radius: 15rpx;
		margin: 40rpx 30rpx;
		padding: 0 30rpx;
				
		.oneBox{
			height: 112rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			
			
			.vixitor{
				display: flex;
				
			
				.box{
					width: 14rpx;
					height: 34rpx;
					background-color: #0062ff;
					border-top-left-radius: 30rpx;
					border-bottom-left-radius: 30rpx;
					border-top-right-radius: 30rpx;
					border-bottom-right-radius: 30rpx;
					margin: 0 18rpx 0 30rpx;
				}
			}
			
			.force{
				width: 136rpx;
				height: 40rpx;
				text-align: center;
				border-radius: 15rpx;
				background-color: #d4f6e3;
				color: #3bd67f;
			}
		}
		.news{
			height: 112rpx;
			line-height: 112rpx;
			border-bottom: 1rpx solid #eee;
			display: flex;
			
			text:nth-child(1){
				width: 140rpx;
				height: 28rpx;
				margin-right: 30rpx;
				color:#adadad ;
			}
		}
		
	}
	.btn{
		width: 682rpx;
		height: 80rpx;
		text-align: center;
		line-height: 80rpx;
		background-color:#006eff ;
		color: #fff;
		margin-left: 30rpx;
		border-radius: 10rpx;
	}
}
</style>
